package com.aiti.lulian.feign;

import com.aiti.base.core.utils.message.Message;
import com.aiti.lulian.entity.crad.CardChangeCardRole;
import com.aiti.lulian.feign.config.Configuration;
import com.aiti.lulian.feign.impl.CloudShowManagerSubServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Primary
@FeignClient(name = "cloud-manage-subservice", fallback = CloudShowManagerSubServiceFallBack.class, configuration = Configuration.class)
public interface CloudShowManagerSubService {

    @GetMapping(value = "/subUser/getUserIdByUserName/{userName}")
    Message getUserIdByUserName(@PathVariable("userName") String userName);

    @GetMapping(value = "/subUser/getUserList/{userIds}")
    Message getUserList(@PathVariable(value = "userIds") String userIds);

    @GetMapping({"subUser/users/{userId}"})
    Message getUserInfo(@PathVariable("userId") String userId);

    @GetMapping("/subUser/scope/{userId}")
    Message queryUserAccessScope(@PathVariable("userId") String userId);

    @GetMapping({"/subUser/users"})
    Message getUsersInfo(@RequestParam("userIds") List<String> userIds);

    @PostMapping("/subUser/addUserRole")
    Message addUserRole(@RequestBody Map<String, String> params);

    @PostMapping("/subUser/addUserRoleNew")
    Message addUserRoleNew(@RequestBody Map<String, String> params);

    @GetMapping({"/sysDept/deptInfo/{deptId}"})
    Message getDeptNameByDeptId(@PathVariable("deptId") String deptId);

    @GetMapping({"/sysDept/getRoleByUserId/{userId}"})
    Message getRoleByUserId(@PathVariable("userId") String userId);

    @GetMapping({"/subUser/getUserIsDeptQx/{userId}"})
    Message getUserIsDeptQx(@PathVariable("userId")String userId);

    /**
     * 通过部门ID查询子级部门
     * @param deptId
     * @return
     */
    @GetMapping({"/sysDept/getSubDeptByDeptId/{deptId}"})
    Message getSubDeptByDeptId(@PathVariable("deptId")String deptId);

    @GetMapping("/sysDept/getUserIds")
    Message getUserIdsByDeptId(@RequestParam("deptId") String deptId);

    @GetMapping("/subUser/getDeptIdByUserId/{userId}")
    Message getDeptIdByUserId(@PathVariable("userId") String userId);

    /**
     * 在切换高级版或基础版的时候更新对应员工的角色
     * @return
     */
    @PostMapping("/subUser/updateEnterpriseRyRole")
//    @PostMapping("/updateEnterpriseRyRole")
    Message updateEnterpriseRyRole(@RequestBody List<CardChangeCardRole> params);

    @PostMapping("/subUser/queryUserOpenIdByUserId")
    Message queryUserOpenIdByUserId(@RequestBody List<String> userId);

    @PutMapping("/subUser/update/batch")
    Message updateSubUserBatch(@RequestBody Map<String, Object> subUserDtoMap);

    @GetMapping("/sysDept/userIds")
    Message getUserIds(@RequestParam("userId") String userId);

    @GetMapping("/subUser/isExisting2")
    Message isExisting2(@RequestParam(value = "username") String username);

    /**
     * 移除名片模板下的所有用户
     * @param templateId
     * @return
     */
    @DeleteMapping("/subUser/removeUserTemplateByTemplateId")
    public Message removeUserTemplateByTemplateId(@RequestParam("templateId") String templateId);


    @GetMapping(value = "/sysRole/getUserRoleList")
    List<String> getUserRoleList(@RequestParam("userId") String userId);

    @GetMapping("/subUser/getAllUsers")
    List<String> getAllUsers();
}